import axios from '@/utils/request'
export default {
  HuifuAccount: {
    list: {
      query: {
        '@filter': `entity.getId() > 1`
      },
      disabled_actions: ['lines'],
      list_filter: {
        'name': '姓名',
        'mobile': '电话',
        'idCardNo': '身份证',
        'bankCardNo': '银行卡号'
      },
      list_display: [
        'id',
        // 'store',
        // 'user',
        { property: 'huifuId', label: '汇付客户ID ' },
        // { property: 'autoWithdraw', label: '自动提现', editable: true },
        { property: 'name', label: '姓名' },
        // { property: 'indvBaseInfo.cert_no', label: '证件号' },
        { property: 'mobile', label: '手机号' },
        { property: 'idCardNo', label: '身份证号' },
        {
          property: 'bankCardNo',
          label: '提现银行卡'
        },
        {
          property: 'balance',
          label: '汇付钱包余额',
          component: {
            props: ['record'],
            data() {
              return {
                amount: ''
              }
            },
            created() {
              axios.get(`/manage/huifu-accounts/${this.record.id}/balance`).then((res) => {
                console.log('汇付balance')
                if (res.data[0].balance_amt > 0) {
                  this.amount = res.data[0].balance_amt
                } else {
                  this.amount = '-'
                }
              })
            },
            render(h) {
              return <div>
                <p onClick={() => {
                  axios.get(`/manage/huifu-accounts/${this.record.id}/balance`).then((res) => {
                    console.log('汇付balance')
                    this.amount = res.data[0].balance_amt
                  })
                }}>{this.amount}</p>
              </div>
            }
          }
        }
      ]
    },
    form: {
      fields: [
        // { property: 'huifuId', field_options: { label: '汇付客户ID' }}
      ]
    }
  }
}

